跳到主要内容

sun4i_tcon_get_engine_by_id

API 概述

sun4i_tcon_get_engine_by_idLinux kernel 中的一个API。该规属于return value check 类型。该规则是使用 APISpecGen 生成的。

规则描述

提示

sun4i_tcon_get_engine_by_id returns error pointer on failure, use IS_ERR to check the return value

信息

标签:return value check

参数下标:N/A

CWE类别:CWE-253

规则代码


import cpp
import semmle.code.cpp.controlflow.SSA


class EVPFunctionCall extends FunctionCall {
EVPFunctionCall() {
this.getTarget().hasName("sun4i_tcon_get_engine_by_id")
}
}


predicate isErrCheckFunction(Function f) {
f.hasName("IS_ERR")
}

from EVPFunctionCall call, ValueAccess ret
where
ret = call.getAnAccess() and
not exists(FunctionCall check |
isErrCheckFunction(check.getTarget()) and
check.getArgument(0).getAChild*() = ret
)
select call, "The return value of sun4i_tcon_get_engine_by_id is not checked with IS_ERR."